<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <!-- <meta charset="gb2312"> -->
    
    <meta name="author" content="">

    <meta name="Keywords" content="">
    <meta name="description" content="">
    
    <!-- 启用360浏览器的极速模式(webkit)-->
        <meta name="renderer" content="webkit">          
        <!-- 避免IE使用兼容模式 -->
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
    <!-- mobile -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no" />
    
    <link rel="shortcut icon" href="favicon.ico" type="images/x-icon" />
    <link rel="bookmark" href="favicon.ico" />
    
    <title>金塔珠宝</title>
    <!--[if lt IE 9 ]>
            <script src="js/hack/html5shiv.js"></script>
        <![endif]-->
<!--        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>-->
        
        <!-- <script src="http://192.168.1.106:81/con/assets/js/f5.js"></script> -->
        

    <link rel="stylesheet" href="../Public/css/base.css">
    <link rel="stylesheet" href="../Public/css/common.css">
    <link rel="stylesheet" href="../Public/css/page.css">
    <link rel="stylesheet" href="../Public/css/font.css">
        <link rel="stylesheet" href="../Public/css/responsive.css">
        
        
  </head>
  <body>
        <!-- nav [[ -->
        <include file="Common:header"/>
    <!-- nav ]] -->

    <!-- header [[ -->
        <!-- <header class="header">
            <div class="title">
                <div class="bg">
                    <span class="icon"></span>
                    <span class="txt">购物车</span>
                </div>
            </div>
        </header> -->
    <!-- header ]] -->
              <form action="{:U('Orders/index')}" method="get">


              <input type="hidden" name="m" value="Home"   >
          <input type="hidden" name="c" value="Orders"   >
            <input type="hidden" name="a" value="index"   >
        <!-- content [[ -->
        <div class="content mod_shop" id="">

             <volist name="gouwu" id="vo" empty="$empty">
             <ul class="item_list clearFix">
                 <li class="item_li item_chk">
                     <label style="margin-top: 50px">
                         <input class="li_chk" id="" type="checkbox" name="ids[]" value="{$vo.id}">
                     </label>
                 </li>
                 <li class="item_li item_img">
                     <img src="Uploads/{$vo.img}" alt="" class="img">
                 </li>
                 <li class="item_li item_info">
                     <p class="item_title">{$vo.name}</p>
           
                     <ol class="item_parameter">
                                  <notempty name="vo.chengse">
                            <li class="p_list"><span class="txt_title">材质</span>{$vo.chengse}</li>
                        </notempty>
                         <notempty name="vo.guige">
                            <li class="p_list"><span class="txt_title">规格</span>{$vo.guige}</li>
                      </notempty>
                       <notempty name="vo.gjinz">
                            <li class="p_list"><span class="txt_title">重量</span>{$vo.gjinz}</li>
                            </notempty>
                        <notempty name="vo.gyanse">
                            <li class="p_list"><span class="txt_title">颜色</span>{$vo.gyanse}</li>
                              </notempty>
                       
                          <li class="p_list">  
                        <span class="txt_title" style="top:16%">数量</span>
                    <input style="width: 20%;outline: none;border: 1px solid #cccccc;text-align: center;    -webkit-border-radius: 0px;background: #cccccc;border-radius:0px;-webkit-appearance:button;height: 30px" type="button" value="-" onClick="reduce(this,{$vo.id})">
                     <input style="width: 20%; text-align: center;outline: none;font-size:14px;border: 1px solid #cccccc;border-radius:0px;-webkit-border-radius: 0px; background: #fff;height: 28px" class="shuliang" value="{$vo.gshul}" type='number' pattern="[0-9]*" oninput="gwcshul(this,{$vo.id})">
                     <input style="width: 20%;outline: none;border: 1px solid #cccccc;text-align: center;    -webkit-border-radius: 0;background: #cccccc;border-radius:0px;-webkit-appearance:button;height: 30px" type="button" value="+" onClick="increase(this,{$vo.id})" >
                        </li>
                     </ol>
         
                     
                 </li>
             </ul>
      </volist>
      <notempty name="gouwu">
             <div class="btn_wrap clearFix">
                <a href="javascript:;" id="shanchu" class="mod_btn">删除</a>
                <a href="javascript:;" id="dianji" class="mod_btn">立即下单</a>
            </div>
            </notempty>
        </div>
        <!-- content ]] -->
          </form>
        <!-- footer [[ -->
       <include file="Common:footer"/>
       <script type="text/javascript" src="../Public/layer/layer.js"></script>
       <script>

$(function(){
$('#dianji').click(function(){
if (!$('input[type="checkbox"]').is(':checked')) {
  layer.msg('请选择后下单',{time:1000});
  return false;
}
 
  $('form').submit();
})

})
$('#shanchu').click(function(){
  if (!$('input[type="checkbox"]').is(':checked')) {
  layer.msg('请选择删除',{time:1000});
  return false;
}
   var id= new Array();
      $.each($(".li_chk").serializeArray(), function(i, field){
        id.push(field.value);
    });
   $.ajax({
      url:'{:U("User/delete")}',
    type:"post",
        data:{'id':id},
   success:function(data){
    if (data==1) {
      layer.msg('删除商品成功',{time:1000},function(){
      location.reload();

      });
    }
   }
   })
  
})




    function reduce(obj,id){
   var num=parseInt($(obj).next('.shuliang').val());
   if (num>1) {
     $(obj).next('.shuliang').val(num-1);

   }
          var shul= parseInt($(obj).next('.shuliang').val());                          
         $.ajax({
      url:'{:U("User/gwcshul")}',
      data:{
         'id':id,
          'shul':shul
        },
        type:'post',
        dataType:'json',
        success:function(data){
  }

    });



  }

  function increase(obj,id){
       var num=parseInt($(obj).prev('.shuliang').val());
        if (num>=1) {
      $(obj).prev('.shuliang').val(num+1);
       }

 var shul= parseInt($(obj).prev('.shuliang').val());                          
         $.ajax({
      url:'{:U("User/gwcshul")}',
      data:{
         'id':id,
          'shul':shul
        },
        type:'post',
        dataType:'json',
        success:function(data){
  }

    });

}

function gwcshul(obj,id){
 var shul= parseInt($(obj).val()); 
                        
         $.ajax({
      url:'{:U("User/gwcshul")}',
      data:{
         'id':id,
          'shul':shul
        },
        type:'post',
        dataType:'json',
        success:function(data){
  }

    });


}

// $('input[type="text"]').click(function(){
//     $('input[type="text"]').val('1');
// })
$('input[type=number]').keypress(function(e) {
　　if (!String.fromCharCode(e.keyCode).match(/[0-9\.]/)) {
　　　　return false;
　　}
});

        function onkeyup (obj) {
          value=objvalue.replace(/[^0-9]/g,'');
            alert("The new content: " + obj.value+id);
        }

       </script>
  </body>
</html>